import { t } from '@/locales/i18n';

export enum VariableConditionEnum {
  equalTo = 'equalTo',
  notEqual = 'notEqual',
  isEmpty = 'isEmpty',
  isNotEmpty = 'isNotEmpty',
  include = 'include',
  notInclude = 'notInclude',
  startWith = 'startWith',
  endWith = 'endWith',

  reg = 'reg',

  greaterThan = 'greaterThan',
  greaterThanOrEqualTo = 'greaterThanOrEqualTo',
  lessThan = 'lessThan',
  lessThanOrEqualTo = 'lessThanOrEqualTo',

  lengthEqualTo = 'lengthEqualTo',
  lengthNotEqualTo = 'lengthNotEqualTo',
  lengthGreaterThan = 'lengthGreaterThan',
  lengthGreaterThanOrEqualTo = 'lengthGreaterThanOrEqualTo',
  lengthLessThan = 'lengthLessThan',
  lengthLessThanOrEqualTo = 'lengthLessThanOrEqualTo',
}
export enum IfElseResultEnum {
  IF = 'IF',
  ELSE = 'ELSE',
  ELSE_IF = 'ELSE IF',
}

export const ConditionText = {
  [VariableConditionEnum.isEmpty]: t('is_empty'),
  [VariableConditionEnum.isNotEmpty]: t('is_not_empty'),
  [VariableConditionEnum.equalTo]: t('is_equal_to'),
  [VariableConditionEnum.notEqual]: t('is_not_equal'),
  [VariableConditionEnum.reg]: t('regex'),
  [VariableConditionEnum.include]: t('contains'),
  [VariableConditionEnum.notInclude]: t('not_contains'),
  [VariableConditionEnum.startWith]: t('start_with'),
  [VariableConditionEnum.endWith]: t('end_with'),
  [VariableConditionEnum.greaterThan]: t('greater_than'),
  [VariableConditionEnum.greaterThanOrEqualTo]: t('greater_than_or_equal_to'),
  [VariableConditionEnum.lessThan]: t('less_than'),
  [VariableConditionEnum.lessThanOrEqualTo]: t('less_than_or_equal_to'),
  [VariableConditionEnum.lengthEqualTo]: t('length_equal_to'),
  [VariableConditionEnum.lengthNotEqualTo]: t('length_not_equal_to'),
  [VariableConditionEnum.lengthGreaterThan]: t('length_greater_than'),
  [VariableConditionEnum.lengthGreaterThanOrEqualTo]: t('length_greater_than_or_equal_to'),
  [VariableConditionEnum.lengthLessThan]: t('length_less_than'),
  [VariableConditionEnum.lengthLessThanOrEqualTo]: t('length_less_than_or_equal_to'),
  [undefined]: '未选择条件',
};

export const stringConditionList = [
  { label: t('is_empty'), value: VariableConditionEnum.isEmpty },
  { label: t('is_not_empty'), value: VariableConditionEnum.isNotEmpty },
  { label: t('is_equal_to'), value: VariableConditionEnum.equalTo },
  { label: t('is_not_equal'), value: VariableConditionEnum.notEqual },
  { label: t('regex'), value: VariableConditionEnum.reg },
  { label: t('contains'), value: VariableConditionEnum.include },
  { label: t('not_contains'), value: VariableConditionEnum.notInclude },
  { label: t('start_with'), value: VariableConditionEnum.startWith },
  { label: t('end_with'), value: VariableConditionEnum.endWith },
];
export const numberConditionList = [
  { label: t('is_empty'), value: VariableConditionEnum.isEmpty },
  { label: t('is_not_empty'), value: VariableConditionEnum.isNotEmpty },
  { label: t('is_equal_to'), value: VariableConditionEnum.equalTo },
  { label: t('is_not_equal'), value: VariableConditionEnum.notEqual },
  { label: t('greater_than'), value: VariableConditionEnum.greaterThan },
  {
    label: t('greater_than_or_equal_to'),
    value: VariableConditionEnum.greaterThanOrEqualTo,
  },
  { label: t('less_than'), value: VariableConditionEnum.lessThan },
  { label: t('less_than_or_equal_to'), value: VariableConditionEnum.lessThanOrEqualTo },
];
export const booleanConditionList = [
  { label: t('is_empty'), value: VariableConditionEnum.isEmpty },
  { label: t('is_not_empty'), value: VariableConditionEnum.isNotEmpty },
  { label: t('is_equal_to'), value: VariableConditionEnum.equalTo },
];
export const arrayConditionList = [
  { label: t('is_empty'), value: VariableConditionEnum.isEmpty },
  { label: t('is_not_empty'), value: VariableConditionEnum.isNotEmpty },
  { label: t('contains'), value: VariableConditionEnum.include },
  { label: t('not_contains'), value: VariableConditionEnum.notInclude },
  { label: t('length_equal_to'), value: VariableConditionEnum.lengthEqualTo },
  { label: t('length_not_equal_to'), value: VariableConditionEnum.lengthNotEqualTo },
  { label: t('length_greater_than'), value: VariableConditionEnum.lengthGreaterThan },
  {
    label: t('length_greater_than_or_equal_to'),
    value: VariableConditionEnum.lengthGreaterThanOrEqualTo,
  },
  { label: t('length_less_than'), value: VariableConditionEnum.lengthLessThan },
  {
    label: t('length_less_than_or_equal_to'),
    value: VariableConditionEnum.lengthLessThanOrEqualTo,
  },
];
export const objectConditionList = [
  { label: t('is_empty'), value: VariableConditionEnum.isEmpty },
  { label: t('is_not_empty'), value: VariableConditionEnum.isNotEmpty },
];
export const allConditionList = [
  { label: t('is_empty'), value: VariableConditionEnum.isEmpty },
  { label: t('is_not_empty'), value: VariableConditionEnum.isNotEmpty },
  { label: t('is_equal_to'), value: VariableConditionEnum.equalTo },
  { label: t('is_not_equal'), value: VariableConditionEnum.notEqual },
  { label: t('contains'), value: VariableConditionEnum.include },
  { label: t('not_contains'), value: VariableConditionEnum.notInclude },
  { label: t('start_with'), value: VariableConditionEnum.startWith },
  { label: t('end_with'), value: VariableConditionEnum.endWith },
  { label: t('greater_than'), value: VariableConditionEnum.greaterThan },
  {
    label: t('greater_than_or_equal_to'),
    value: VariableConditionEnum.greaterThanOrEqualTo,
  },
  { label: t('less_than'), value: VariableConditionEnum.lessThan },
  {
    label: t('less_than_or_equal_to'),
    value: VariableConditionEnum.lessThanOrEqualTo,
  },
  { label: t('length_equal_to'), value: VariableConditionEnum.lengthEqualTo },
  { label: t('length_not_equal_to'), value: VariableConditionEnum.lengthNotEqualTo },
  { label: t('length_greater_than'), value: VariableConditionEnum.lengthGreaterThan },
  {
    label: t('length_greater_than_or_equal_to'),
    value: VariableConditionEnum.lengthGreaterThanOrEqualTo,
  },
  { label: t('length_less_than'), value: VariableConditionEnum.lengthLessThan },
  {
    label: t('length_less_than_or_equal_to'),
    value: VariableConditionEnum.lengthLessThanOrEqualTo,
  },
];
